package com.sprouting.ops.service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sprouting.ops.dao.OpsDeployLinkDao;
import com.sprouting.ops.model.OpsDeployLink;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import javax.annotation.Resource;
import java.util.List;

/**
 * 部署关联信息表;(OpsDeployLink)(OPS_DEPLOY_LINK) 表服务实现类
 *
 * @author ：lx（长沙麓谷）
 * @date 创建时间：2025-06-29 22:18:44
 */
@Service
@Slf4j
public class OpsDeployLinkService extends ServiceImpl<OpsDeployLinkDao, OpsDeployLink> {

    @Resource
    private OpsDeployLinkDao opsDeployLinkDao;

    /**
     * 分页查询 部署关联信息表;
     * @param page 分页参数
     * @param query 查询参数
     * @return
     */
    public Page<OpsDeployLink> getListPage(Page page, OpsDeployLink query){
        return opsDeployLinkDao.getListPage(page, query);
    }

    /**
     * 根据部署id和环境id查询部署关系
     * @param opsDeployId 部署id
     * @param envId 环境id
     * @return
     */
    public OpsDeployLink getByOpsDeployIdAndEnvId(String opsDeployId, String envId) {
        return opsDeployLinkDao.getByOpsDeployIdAndEnvId(opsDeployId, envId);
    }

    /**
     * 根据部署id查询关联的环境
     * @param opsDeployId 部署id
     * @return 关联的环境信息
     */
    public List<OpsDeployLink> getByOpsDeployId(String opsDeployId) {
        return opsDeployLinkDao.getByOpsDeployId(opsDeployId);
    }
}
